package wh.bos.service.base.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import wh.bos.dao.base.CourierRepository;
import wh.bos.domain.base.Courier;
import wh.bos.service.base.CourierService;

@Service
@Transactional
public class CourierServiceImpl implements CourierService{
	@Autowired
	private CourierRepository courierRepository;
	@Override
	public Page<Courier> findAll(Pageable pageable) {
		return courierRepository.findAll(pageable);
	}
	@Override
	public void save(Courier courier) {
		courierRepository.save(courier);
	}
	@Override
	public void delBatch(String[] idArray) {
		for (String string : idArray) {
			Integer id = Integer.parseInt(string);
			courierRepository.delBatch(id);
		}
	}
	@Override
	public Page<Courier> findPageDate(Specification<Courier> specification, Pageable pageable) {
		return courierRepository.findAll(specification,pageable);
	}
	@Override
	public void restore(String[] idArray) {
		for (String string : idArray) {
			Integer id = Integer.parseInt(string);
			courierRepository.restore(id);
		}
	}

}
